<template>
    <div class="forum-list-wrap">

        <div class="list">
            <div class="data">
                <div class="data-item" v-for="(item, index) in list" :key="index">
                    <StudyItem3  :item="item"></StudyItem3>
                </div>
            </div>
        </div>
        <div class="pagination">
            <el-pagination background layout="prev, pager, next" :total="total" @current-change="paginationFun">
            </el-pagination>
        </div>

    </div>
</template>

<script>
import StudyItem3 from "../pageComponents/study-item3.vue";
import {getProductList} from "@/api/study";
export default {
    components: {
        StudyItem3,
    },
    props:{
        keyword:{
            type:String,
            default:''
        }
    },
    data() {
        return {
            list:[],
            total:0,
            params:{
                page:1,
                limit:12
            },
        };
    },
    mounted() {
        this.getListFun();
    },
    methods: {
        paginationFun(page){
            this.params.page = page
            this.getListFun()
        },
        getListFun(){
            getProductList({...this.params,keyword:this.keyword}).then(res=>{
                if(res.code ==200){
                    this.list = res.data.list
                    this.total = res.data.count
                }
            })
        }
    },
};
</script>

<style lang="less" scoped>
.forum-list-wrap {
    .banner {
        width: 100%;
        height: 5.5rem;
        .banner-img {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 100%;
            height: 100%;
            img {
                width: 100%;
                height: 100%;
            }
        }
    }
    
    .type{
        display: flex;
        align-items: center;
        justify-content: flex-end;
        padding-top: 0.375rem;
        .type-item{
            display: flex;
            justify-content: center;
            align-items: center;
            width: 0.5rem;
            height: 0.5rem;
            background: #EEF6FE;
            border-radius: 0.1rem;
            font-size: 0.3125rem;
            color: #4F546B;
            cursor: pointer;
            margin-left: 0.2rem;
        }
        .type-item-active{
            background: #4F8AF8;
            color: #fff;
        }
    }

    .list {
        padding-top: 0.5rem;
    }
    .data{
        display: flex;
        flex-wrap: wrap;
        .data-item{
            width: 4.1875rem;
            margin-right: 0.25rem;
            margin-bottom: 0.375rem;
            &:nth-child(4n){
                margin-right: 0;
            }
        }
    }
    .pagination {
        display: flex;
        justify-content: center;
        padding: 0.375rem 0 1rem;
    }
}
</style>